import request from '@/utils/request'
import defaultSettings from '@/settings'

export const apiUrlConfig = {
  queryUrl: `${defaultSettings.ctx.authorityApp}/s/configInfo/search`,
  exportUrl: `${defaultSettings.ctx.authorityApp}/s/configInfo/search`,
  delUrl: `${defaultSettings.ctx.authorityApp}/s/configInfo/remove`,
}
// 查询配置列表
export function listConfigInfo(query) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/configInfo/search`,
    method: 'get',
    params: query
  })
}

// 查询配置详细
// export function findConfigInfo(configInfoId) {
//   return request({
//     url: `${defaultSettings.ctx.authorityApp}/s/configInfo/` + praseStrEmpty(configInfoId),
//     method: 'get'
//   })
// }

// 新增配置
export function addConfigInfo(data) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/configInfo/save`,
    method: 'post',
    data: data
  })
}

// 删除配置
export function delConfigInfo(id) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/configInfo/remove?ids=${id}`,
    method: 'get'
  })
}

export function getConfigInfo(id) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/configInfo/findConfigInfoById?id=${id}`,
    method: 'get'
  })
}

// 校验配置编码
export function checkConfigKey(data) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/configInfo/checkConfigKeyUnique?id=${data.id}&configKey=${data.configKey}`,
    method: 'get'
  })
}

export function findExpandConfList(parentTableType) {
  return request({
    url: `${defaultSettings.ctx.authorityApp}/s/expandConfInfo/findExpandConfList?parentTableType=${parentTableType}`,
    method: 'get'
  })
}
